Release 10.1A: OpenEdge Development:
Java Open Clients
Managing ProDataObject mappings to temp-tables
OpenEdge releases prior to 10.1A provide only a streaming data model for accessing temp-tables (
TABLEandTABLE-HANDLEonly) as parameters using thejava.sql.ResultSetobject. This model requires the client application (for output parameters) or the Open Client proxy (for input parameters) to request data from the sender (through the SQLResultSet) instead of allowing the sender to set the data in the receiver. It relies on a call back mechanism to access the data one row at a time. Thus, a temp-table is accessible in only one direction, like a one-directional tape. For more information on the SQL ResultSet mechanism, see Appendix C "Passing Temp-tables as SQL ResultSet Parameters."The Java SDO architecture available in the current release is based on a disconnected data model that caches rows of temp-table data in memory using the
DataObjectinterface. This model provides a scrollable access mechanism that allows you to directly access any row of a temp-table that is part of a 4GLDATASETorDATASET-HANDLEparameter and also any row of single temp-table passed as aTABLEorTABLE-HANDLEparameter. (For more information on accessingTABLEandTABLE-HANDLEparameters, see the "Passing temp-tables as ProDataGraph parameters" section.)The SQL
ResultSetand Java SDODataObjectmechanisms support a different set of mappings for fields in a temp-table. The OpenEdgeProDataObjectfurther extends thisDataObjectmechanism to map 4GL data types not supported in the base mechanism. The following sections describe the mappings for temp-table fields supported by this extendedProDataObjectmechanism.Mapping single-valued fields
As described in a previous section (see the "Java SDO Foundations" section), a
DataObject(and itsProDataObjectextension) represents a temp-table field as a columnPropertyobject containing its value, with an associatedTypeobject, specifying its data type. Table 5–3 shows theProDataObjectmappings to temp-table fields supported by OpenEdge.
Table 5–3: Java ProDataObject mappings to temp-table fields 4GL temp-table field data type Java ProDataObject Property data type
In addition to the value, the Property object contains other information about the ProDataObject column that corresponds to the temp-table field, including its position in the row of columns (indicated by a property index) and the property name, which is identical to the 4GL name of the temp-table field.
The ProDataObject class has methods for setting and getting the values of its column Property objects, accessed by property name or index according to data type. For more information, see the "ProDataObject class" section.
Mapping array fields
In the Progress 4GL, a temp-table field can be defined with an extent (an integer value). This extent specifies the size of an array field, which is a one-dimensional array of the specified data type. Similarly in a Java SDO DataObject, the Type associated with a Property object can be defined as many-valued. Thus, a many-valued property of any Java data type listed in Table 5–3 can be mapped to a temp-table array field of the corresponding 4GL data type.
The ProDataObject class has methods for setting and getting the values of its many-valued column Property objects, accessed as List objects by property name or index. To determine if a
Propertyobject is many-valued, you can use theisMany()method on theProperty. For more information on working with the values of many-valued properties, see the descriptions of the getList() and setList() methods in the "ProDataObject class" section.Mapping the Unknown value (?)
In the Progress 4GL, a temp-table field can be specified with an Unknown value (
?), similar tonullin Java. If you need to determine if a field has been set to the Unknown value (?), you can use one of the ProDataObject isSet() methods to test property by name or index. These methods return true if the corresponding temp-table field is set to a value other than the Unknown value (?) and return false if the field is set to the Unknown value (?). For more information on the isSet() methods, see the "ProDataObject class" section. If you want to set a column property so the corresponding temp-table field is set to the Unknown value (?), do not set the property to any value.Specifying initial values
Java SDO does not support setting an initial (or default) value for a property within a DataObject. So, you must explicitly set all initial values for column properties.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |